﻿using SuperBasic.FrontEnd.Inter;
using SuperBasic.FrontEnd.Symbols;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SuperBasic.FrontEnd.Errors
{

    class SourceBlocksNotCloseException : Exception
    {
        public SourceBlocksNotCloseException(int line) : base(line + "行, 程序块未闭合.")
        {

        }
    }

    class TypeMisMatchException : Exception
    {
        public TypeMisMatchException(int line, Symbols.Type T, string except) : base(line + "行, " + "类型:" + T + "不符合转换要求(期待:" + except.ToString() + ")")
        {

        }
    }

    class TypeCovertException : Exception
    {
        public TypeCovertException(int line, Symbols.Type T1, Symbols.Type T2) : base(line + "行, " + "类型:" + T1 + " 不能与 " + T2 + "转换")
        {

        }
    }

    class TokenWrongException : Exception
    {
        public TokenWrongException(Token token, params Tag[] except) : base(token.Line + "行, " + token.TokenTag.ToString() + " 应为 " + except[0])
        {

        }
    }

    class TokenPreserveException : Exception
    {
        public TokenPreserveException(int line, Word token) : base(line + "行, " + "无法使用保留关键字:" + token.lexeme)
        {

        }
    }

    class TokenIdentityNotDeclareException : Exception
    {
        public TokenIdentityNotDeclareException(Word token) : base(token.Line + "行, " + "未定义的变量:" + token.lexeme)
        {

        }
    }

    class TokenNotCloseArrayException : Exception
    {
        public TokenNotCloseArrayException(Word token) : base(token.Line + "行, " + "括号没有闭合" + token.Line)
        {

        }
    }

    class TokenNotConstantException : Exception
    {
        public TokenNotConstantException(Expr token) : base(token.lexline + "行, " + "无法使用非常数初始化可选参数")
        {

        }
    }
}
